#include <boost/fiber/all.hpp>
#include <iostream>
#include <chrono>

void simple_fiber(int id)
{
    std::cout << "Fiber " << id << " started\n";
    boost::this_fiber::yield();
    std::cout << "Fiber " << id << " resumed\n";
    boost::this_fiber::yield();
    std::cout << "Fiber " << id << " finished\n";
}
int main() 
{ 
    std::cout << "Main thread started\n";
    
    // 创建 fibers
    boost::fibers::fiber f1(simple_fiber, 1);
    boost::fibers::fiber f2(simple_fiber, 2);
    
    // 等待 fibers 完成
    f1.join();
    f2.join();
    
    std::cout << "Main thread finished\n";
    return 0;
}